<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /* 数组 */
        let arr = new Array(1,2,3,4);
        // push   => 往数组的末尾添加 => 返回的是新数组的长度
        // let res = arr.push(9)
        // console.log(res,arr);

        Array.prototype.myPush = function(data){
            // console.log(this,data);
            // this => 实例对象
            // data => 传入的参数
            this[this.length] = data;
            return this.length
        }

        let res = arr.myPush(9);
        console.log(res,arr);
    </script>
</body>
</html>